package com.powernode.setting;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

@Configuration
public class  SwaggerConfig {
    @Bean
    public Docket docket(){
        // 文档类型 2.0版本
        Docket docket = new Docket(DocumentationType.SWAGGER_2);
        ApiInfo  apiInfo = new ApiInfoBuilder()
                .title("动力节点盈利宝项目")//标题
                .version("1.0")//项目版本
                .description("盈利宝前后端分离微服务项目")//项目描述
                .contact( new Contact("动力节点java黄埔军校", //文档发布者
                        "http://www.bjpowernode.com",  //文档发布者网站
                        "bjpowernode@bjpowenrode.cn")) //文档发布者的联系邮箱
                .build();
        docket.apiInfo(apiInfo);
        // 指定注解
        docket = docket.select()
                .apis(RequestHandlerSelectors.basePackage("com.powernode.controller")).build();
        return docket;
    }
}
